document.querySelector(".tel").onblur = checkTel;
function checkTel(){
    var tel = document.querySelector(".tel").value;
    if (tel==""||tel==null){
        document.querySelector(".tel-msg").innerText="请输入手机号";
        return false;
    }else{
        document.querySelector(".tel-msg").innerText="";
        return true;
    }
}

document.querySelector(".password").onblur = checkPassword;
function checkPassword(){
    var password = document.querySelector(".password").value;
    if (password==""||password==null){
        document.querySelector(".password-msg").innerText="请输入密码";
        return false;
    }else{
        document.querySelector(".password-msg").innerText="";
        return true;
    }
}

document.querySelector(".captcha").onblur = checkCaptcha;
function checkCaptcha(){
    var captcha = document.querySelector(".captcha").value;
    if (captcha==""||captcha==null){
        document.querySelector(".captcha-msg").innerText="请输入验证码";
        return false;
    }else{
        document.querySelector(".captcha-msg").innerText="";
        return true;
    }
}

//提交表单，验证
document.querySelector(".register-area").onsubmit= function(){
    return checkTel() && checkPassword() && checkCaptcha();//  return true / return false;
}

//点击按钮，触发的事件
document.querySelector(".register-button").onclick = function (){
    //账号
    var tel = document.querySelector(".tel").value;
    console.log("手机号："+tel);
    var password = document.querySelector(".password").value;
    console.log("密码："+password);
    var captcha = document.querySelector(".captcha").value;
    console.log("密码："+captcha);
}